home *** CD-ROM | disk | FTP | other *** search
/ Codemasters Artwork Disc ECTS 2000 ( UK) / Codemasters - Artwork Disc ECTS 2000 (UK).bin / pc / xtras / medial~1 / setfx~1.dir / Internal_111_Radio Button.ls < prev    next >
Encoding:
Text File  |  1998-12-01  |  2.1 KB  |  89 lines

  1. property pSpriteList, pCurActive, pActive, pCallBackObj, pRefcon
  2.  
  3. on new me, propList
  4.   set pSpriteList to getaProp(propList, #sprites)
  5.   set pCurActive to getaProp(propList, #cur)
  6.   set pActive to getaProp(propList, #active)
  7.   set pCallBackObj to getaProp(propList, #callback)
  8.   set pRefcon to getaProp(propList, #ref)
  9.   SetActive(me, pCurActive)
  10.   if pCurActive > count(pSpriteList) then
  11.     set pCurActive to 0
  12.   end if
  13.   return me
  14. end
  15.  
  16. on click me, sNum
  17.   if not pActive then
  18.     exit
  19.   end if
  20.   if not integerp(sNum) then
  21.     set sNum to the clickOn
  22.   end if
  23.   if the memberNum of sprite sNum < 1 then
  24.     exit
  25.   end if
  26.   if not (the name of the member of sprite sNum contains "radioButton") then
  27.     exit
  28.   end if
  29.   set memName to the name of the member of sprite sNum
  30.   set the member of sprite sNum to member (memName && "Down")
  31.   updateStage()
  32.   set selected to 1
  33.   repeat while the stillDown
  34.     if rollOver(sNum) then
  35.       set the member of sprite sNum to member (memName && "Down")
  36.       set selected to 1
  37.     else
  38.       set the member of sprite sNum to member memName
  39.       set selected to 0
  40.     end if
  41.     updateStage()
  42.   end repeat
  43.   set newNum to getPos(pSpriteList, sNum)
  44.   SetActive(me, newNum)
  45.   if objectp(pCallBackObj) then
  46.     RadioClick(pCallBackObj, pRefcon, pCurActive)
  47.   end if
  48.   return pCurActive
  49. end
  50.  
  51. on SetActive me, newNum
  52.   set pCurActive to newNum
  53.   repeat with i = 1 to count(pSpriteList)
  54.     set sNum to getAt(pSpriteList, i)
  55.     puppetSprite(sNum, 1)
  56.     if i = pCurActive then
  57.       set the member of sprite sNum to member "radioButton 1"
  58.       next repeat
  59.     end if
  60.     set the member of sprite sNum to member "radioButton 0"
  61.   end repeat
  62. end
  63.  
  64. on SetEnabled me, enabled
  65.   set pActive to enabled
  66.   repeat with i in pSpriteList
  67.     enableInterfaceElement(i, enabled)
  68.   end repeat
  69. end
  70.  
  71. on ThisYou me, sNum
  72.   repeat with i = 1 to count(pSpriteList)
  73.     if getAt(pSpriteList, i) = sNum then
  74.       return 1
  75.     end if
  76.   end repeat
  77.   return 0
  78. end
  79.  
  80. on GetActiveRadio me
  81.   return pCurActive
  82. end
  83.  
  84. on Release me
  85.   repeat with i = 1 to count(pSpriteList)
  86.     puppetSprite(getAt(pSpriteList, i), 0)
  87.   end repeat
  88. end
  89.